home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / ubiquity / target-config / 30accessibility < prev    next >
Text File  |  2009-10-21  |  11KB  |  180 lines

  1. #!/bin/sh
  2. # If you change this, please also change the copy in scripts/casper-bottom/30accessibility.
  3.  
  4. . /usr/share/debconf/confmodule
  5. . /etc/casper.conf
  6.  
  7. PREREQ=""
  8. DESCRIPTION="Configuring accessibility options..."
  9. db_get passwd/username
  10. TARGET_USERNAME="$RET"
  11.  
  12. gct() {
  13.     chroot /target sudo -u "$TARGET_USERNAME" gconftool-2 "$@"
  14. }
  15.  
  16. kderc_addtoprefixes() {
  17.     if [ -e "/target/etc/kde4rc" ]; then
  18.         sed -i "s|\\(prefixes=/usr/share/kubuntu-default-settings/kde-profile/default/\\)|\\1,$1|" /target/etc/kde4rc
  19.     fi
  20. }
  21.  
  22. # Code to remove an applet from the default panel setup
  23. # This is rather hacky, but I can't think of a one or two line regular
  24. # expression to do this any more efficiently. Patches welcome.
  25. # In addition, setting these via gconf also doesn't work for some reason.
  26. remove_applet()
  27. {
  28.         local line_no prior_line next_line
  29.  
  30.         line_no=$(grep -n "<string>$1</string>" /target/usr/share/gconf/defaults/05_panel-default-setup.entries | cut -f 1 -d :)
  31.         [ "$line_no" ] || return
  32.         prior_line=$((line_no-1))
  33.         next_line=$((line_no+1))
  34.         sed -i -n "${prior_line},${next_line}!p" /target/usr/share/gconf/defaults/05_panel-default-setup.entries
  35.         chroot /target update-gconf-defaults
  36. }
  37.  
  38. for x in $(cat /proc/cmdline); do
  39.                 case $x in
  40.                         # Lesser Visual Impairment
  41.                         access=v1)
  42.                         gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
  43.                         gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
  44.                         gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
  45.                         gct -s -t string /desktop/gnome/interface/font_name "sans 18"
  46.                         gct -s -t string /apps/metacity/general/theme Atlanta
  47.                         gct -s -t string /desktop/gnome/background/picture_filename ""
  48.                         gct -s -t string /desktop/gnome/background/picture_options none
  49.                         gct -s -t string /desktop/gnome/background/primary_color \#666666
  50.                         gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
  51.                         gct -s -t string /desktop/gnome/background/color_shading_type solid
  52.                         gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
  53.                         gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
  54.                         kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/
  55.                         if [ -d /target/usr/share/xubuntu-default-settings/accessibility ]; then
  56.                             cp -a /target/usr/share/xubuntu-default-settings/accessibility/* /target/etc/xdg/
  57.                         fi
  58.                         ;;
  59.                         # Moderate Visual Impairment
  60.                         access=v2)
  61.                         gct -s -t bool /desktop/gnome/interface/accessibility true
  62.                         gct -s -t bool /apps/gksu/disable-grab true
  63.                         gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
  64.                         gct -s -t bool /desktop/gnome/applications/at/visual/startup true
  65.                         gct -s -t string /desktop/gnome/applications/at/visual/exec orca
  66.  
  67.                         if [ -d /usr/share/xubuntu-default-settings ]; then
  68.                           apt-install gnome-orca gnome-mag
  69.                         fi
  70.  
  71.             if [ -x /target/usr/bin/orca ]; then
  72.                 if [ -f /home/$USERNAME/.orca/user-settings.py ]; then
  73.                     cp -r /home/$USERNAME/.orca /target/home/$TARGET_USERNAME/
  74.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  75.                 else
  76.                     mkdir -p /target/home/$TARGET_USERNAME/.orca
  77.                     echo "import orca.settings" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  78.                     echo "orca.settings.enableSpeech = True" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  79.                     echo "orca.settings.enableMagnifier = True" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  80.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  81.                 fi
  82.             fi
  83.                         sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /target/etc/sudoers
  84.  
  85.                         kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/,/usr/share/kubuntu-default-settings/kde-profile/moderate-visual-impairment/
  86.                         ;;
  87.                         # Blindness
  88.                         access=v3)
  89.                         gct -s -t bool /desktop/gnome/interface/accessibility true
  90.                         gct -s -t bool /apps/gksu/disable-grab true
  91.                         gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
  92.                         gct -s -t bool /desktop/gnome/applications/at/visual/startup true
  93.                         gct -s -t string /desktop/gnome/applications/at/visual/exec orca
  94.                         remove_applet fast_user_switch
  95.             if [ -x /target/usr/bin/pulse-session ]; then
  96.                 mkdir -p /target/var/lib/pulseaudio
  97.                 touch /target/var/lib/pulseaudio/pulse_a11y_nostart
  98.                 chroot /target chown root.root /var/lib/pulseaudio/pulse_a11y_nostart
  99.                 mkdir -p /target/home/$TARGET_USERNAME/.pulse
  100.                 echo "autospawn = no" > /target/home/$TARGET_USERNAME/.pulse/client.conf
  101.                 chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.pulse
  102.             fi
  103.                         sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /target/etc/sudoers
  104.             if [ -x /target/usr/bin/orca ]; then
  105.                 if [ -f /home/$USERNAME/.orca/user-settings.py ]; then
  106.                     cp -r /home/$USERNAME/.orca /target/home/$TARGET_USERNAME/
  107.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  108.                 else
  109.                     mkdir -p /target/home/$TARGET_USERNAME/.orca
  110.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  111.                 fi
  112.             fi
  113.  
  114.                         if [ -d /usr/share/xubuntu-default-settings ]; then
  115.                           apt-install gnome-orca
  116.                         fi
  117.                         ;;
  118.                         # Braille
  119.                         braille=ask)
  120.                         gct -s -t bool /desktop/gnome/interface/accessibility true
  121.                         gct -s -t bool /desktop/gnome/applications/at/visual/startup true
  122.                         gct -s -t string /desktop/gnome/applications/at/visual/exec orca
  123.                         if [ -x /target/usr/bin/orca ]; then
  124.                 if [ -f /home/$USERNAME/.orca/user-settings.py ]; then
  125.                     cp -r /home/$USERNAME/.orca /target/home/$TARGET_USERNAME/
  126.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  127.                 else
  128.                                     mkdir -p /target/home/$TARGET_USERNAME/.orca
  129.                     echo "import orca.settings" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  130.                                     echo "orca.settings.enableSpeech = False" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  131.                                     echo "orca.settings.enableBraille = True" >> /target/home/$TARGET_USERNAME/.orca/user-settings.py
  132.                     chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.orca
  133.                 fi
  134.                         fi
  135.                         gct -s -t bool /apps/gksu/disable-grab true
  136.                         gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
  137.                         remove_applet fast_user_switch
  138.                         sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /target/etc/sudoers
  139.             if [ -x /target/usr/bin/pulse-session ]; then
  140.                 mkdir -p /target/var/lib/pulseaudio
  141.                 touch /target/var/lib/pulseaudio/pulse_a11y_nostart
  142.                 chroot /target chown root.root /var/lib/pulseaudio/pulse_a11y_nostart
  143.                 mkdir -p /target/home/$TARGET_USERNAME/.pulse
  144.                 echo "autospawn = no" > /target/home/$TARGET_USERNAME/.pulse/client.conf
  145.                 chroot /target chown -R $TARGET_USERNAME.$TARGET_USERNAME /home/$TARGET_USERNAME/.pulse
  146.             fi
  147.                         ;;
  148.                         # Minor Motor Difficulties
  149.                         access=m1)
  150.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
  151.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
  152.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
  153.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
  154.                         gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
  155.                         gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
  156.                         gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
  157.                         gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
  158.                         gct -s -t bool /apps/gksu/disable-grab true
  159.                         kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/
  160.                         if [ -e /target/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
  161.                             sed -i 's/0/1/' /target/etc/xdg/xfce4/mcs_settings/keyboard.xml
  162.                         fi
  163.                         ;;
  164.                         # Motor Difficulties - pointing devices
  165.                         access=m2)
  166.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
  167.             gct -s -t bool /desktop/gnome/interface/accessibility true
  168.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
  169.                         gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
  170.                         gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
  171.                         gct -s -t bool /desktop/gnome/applications/at/mobility/startup true
  172.                         gct -s -t string /desktop/gnome/applications/at/mobility/exec onboard
  173.                         kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/,/usr/share/kubuntu-default-settings/kde-profile/motor-difficulties-pointing-devices/
  174.                         if [ -e /target/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then
  175.                             sed -i '/Sticky/ s/0/1/' /target/etc/xdg/xfce4/mcs_settings/keyboard.xml
  176.                         fi
  177.                         ;;
  178.         esac
  179. done
  180.